﻿namespace DynaBoard
{
    using System;

    [IsRequired(false)]
    [MaxLength(320)]
    [RegexPattern(@"^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$")]
    public class AuthorEmail : UserInputString 
    {
        public AuthorEmail(string email)
            : base(email, true)
        { }

        public static implicit operator String(AuthorEmail email)
        {
            return email.value;
        }

        public static implicit operator AuthorEmail(string email)
        {
            return new AuthorEmail(email);
        }
    }
}